<template>
  <div class="wrap">
    <header>
      <span @click="go()">&lt;</span>
      <p>开团</p>
    </header>
    <main>
      <dl class="list">
        <dt>
          <img :src="list.img" alt />
        </dt>
        <dd>
          <h3>{{list.title}}</h3>
          <p>{{list.location}}</p>
          <div class="t11">
            <p>
              <label>活动时间:</label>
              <span>{{list.date}}</span>
            </p>
            <p>
              <label>已报名:</label>
              <span>{{list.id}}人</span>
            </p>
          </div>
        </dd>
      </dl>
      <div class="intro">
        <h3>团购介绍</h3>
        <p>
          {{list.introduce}}
          <span>团购介绍团购介绍团介绍团购介购介绍团购</span>
          <span>{{list.introduce}}</span>
        </p>
      </div>
      <div class="pers">
        <div>
          <h4>集合地址</h4>
          <input type="text" v-model="obj.city" placeholder="输入集合地址" />
        </div>
        <div>
          <h4>车辆牌号</h4>
          <input type="text" v-model="obj.title" placeholder="输入车辆牌号" />
        </div>
        <div>
          <h4>集合时间</h4>
          <input type="text" v-model="obj.name" placeholder="选择集合时间" />
        </div>
      </div>
    </main>
    <footer>
      <p @click="toTuan()">开团</p>
    </footer>
  </div>
</template>

<script>
import axios from "../../utils/request";
export default {
  data() {
    return {
      list: [],
      lists: [],
      obj: {
        bianhao: "4567890",
        title: "",
        name: "",
        city: "",
        date: "2021-09-02 22:25:58",
        img:
          "https://img0.baidu.com/it/u=1246802697,1936907220&fm=26&fmt=auto&gp=0.jpg"
      }
    };
  },
  created() {
    this.tuandetail();
    this.getlist();
  },
  methods: {
    go() {
      this.$router.go(-1);
    },

    //详情渲染
    tuandetail() {
      axios({
        url: "/api/detail",
        method: "post",
        data: this.$route.params
      }).then(res => {
        // console.log(res);
        this.list = res.data.data;
      });
    },

    //渲染
    getlist() {
      axios({
        url: "/api/getList",
        method: "post"
      }).then(res => {
        console.log(res);
        this.lists = res.data.data;
      });
    },

    //删除
    del(id) {
      axios({
        url: "/api/delList",
        method: "post",
        data: { id }
      }).then(res => {
        console.log(res);
        this.getlist();
      });
    },

    //
    toTuan() {
      axios({
        url: "/api/addList",
        method: "post",
        data: this.obj
      }).then(res => {
        console.log(res);
        this.getlist();
      });
      this.$router.push("/tuan");
    }
  }
};
</script>

<style lang="scss" scoped>
.wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  width: 100%;
  height: 50px;
  display: flex;
  line-height: 50px;
  align-items: center;
  background: rgb(56, 121, 240);
  padding: 15px;
  color: #fff;
  p {
    padding-left: 38%;
  }
}
main {
  flex: 1;
  overflow-y: scroll;
  .list {
    margin: 15px;
    dt img {
      width: 100%;
      height: 210px;
    }
    dd {
      h3 {
        padding: 5px 0;
        font-size: 18px;
      }
      p {
        font-size: 15px;
      }
      .t11 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 5px 0;
      }
    }
  }
  .intro {
    margin: 15px;
    h3 {
      padding: 10px 0;
    }
    p {
      font-size: 15px;
      color: rgb(141, 140, 140);
      line-height: 26px;
    }
  }
  .pers {
    margin: 15px;
    div {
      margin: 10px 0;
      h4 {
        padding: 10px 0;
        color: rgb(94, 89, 89);
      }
      input {
        width: 340px;
        height: 40px;
        border: 1px solid;
        border-radius: 3px;
        text-indent: 12px;
      }
    }
  }
}
footer {
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background: rgb(56, 121, 240);
  p {
    font-size: 18px;
    color: #fff;
  }
}
</style>